﻿using System;
using System.Collections.ObjectModel;
using System.Text;

namespace StandardDAC {
    /// <summary>
    /// Keyed collection by Id
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ModelKeyedCollection<T> : KeyedCollection<int, T> where T : IDataModel {
        /// <summary>
        /// Returns the id of the item, which is the key for this collection
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override int GetKeyForItem(T item) {
            return item.Id;
        }
    }
}
